package com.juntuo.controller;

import com.github.pagehelper.PageInfo;
import com.juntuo.Enums.ParkStatus;
import com.juntuo.entity.Device;
import com.juntuo.entity.Park;
import com.juntuo.platformUtils.QueryDevicesUtil;
import com.juntuo.service.DeviceService;
import com.juntuo.service.ParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 对设备等进行管理
 * @author chenxj
 * @create 2017/03/03 11:04
 */
@Controller
@RequestMapping("/platform")
public class DevicePlatformController {

    @Autowired
    private DeviceService deviceService;
    @RequestMapping("/index")
    public String toIndex(){
        return "/platform/index";
    }

    @RequestMapping("/page")
    @ResponseBody
    public PageInfo<Device> getAllList(int pageNumber, int pageSize, Integer status,String startTime,String endTime) throws Exception {
//        PageInfo<Device> pageInfo=QueryDevicesUtil.queryDevices(1,200,null,null,null);
//        List<Device> devices = pageInfo.getList();
//        for(Device device:devices){
//            device.setCreateTime(new Date());
//            deviceService.insert(device);
//        }



        return QueryDevicesUtil.queryDevices(pageNumber,pageSize,status,startTime,endTime);
    }




}
